-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tui: Fix TUI display issues in non-UTF-8 locales #1974
base: master
Are you sure you want to change the base?
Conversation
96c38f3
to
33570dc
Compare
I've addressed the issue #1870 regarding the TUI display in non-UTF-8 locales. Here's a summary of the changes and their effects: In non-UTF-8 locales, the TUI was displaying incorrect characters, making the graph structure unclear and difficult to read. Now, the TUI correctly detects the locale setting and adjusts its display accordingly. In non-UTF-8 locales, it uses ASCII characters to represent the graph structure, ensuring clarity and readability across different environments. Key changes:
These changes should resolve the display issues while maintaining the functionality and user experience of the TUI across various locale settings. Please review and let me know if any further adjustments are needed. |
33570dc
to
8340a73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update, only some nitpicks below.
Hi @GabrielKimm, I see your name isn't correctly shown in the commit as follows.
Please put your real name rather than You can check it at https://github.com/namhyung/uftrace/pull/1974.patch. |
cc92917
to
39030ab
Compare
Your author name isn't changed yet. Please update it together.
As far as I remember, your name is "Gabriel Kim" so please use your full name. You can update it as follows.
|
In addition, you need to put category prefix for the commit title as follows.
|
39030ab
to
55a7afe
Compare
It usually takes some time to get patches for review but it'd be useful to have a script for that. The 'checkout-pr.sh' script accepts a single parameter to get the pull request ID. It fetches from the source repo and checkouts to the fetched head. The example usage is as follows. $ ./misc/checkout-pr.sh 1974 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18502 100 18502 0 0 39899 0 --:--:-- --:--:-- --:--:-- 39875 remote: Enumerating objects: 1, done. remote: Counting objects: 100% (1/1), done. remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0 (from 0) Unpacking objects: 100% (1/1), 354 bytes | 354.00 KiB/s, done. From https://github.com/GabrielKimm/uftrace * branch fix-tui-non-utf8-locale -> FETCH_HEAD Switched to and reset branch 'pull/1974' Now you're ready to review the pull request 1974 where can be found at namhyung#1974. Signed-off-by: Honggyu Kim <[email protected]>
deb66a3
to
6f8a9c8
Compare
It usually takes some time to get patches for review but it'd be useful to have a script for that. The 'checkout-pr.sh' script accepts a single parameter to get the pull request ID. It fetches from the source repo and checkouts to the fetched head. The example usage is as follows. $ ./misc/checkout-pr.sh 1974 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18502 100 18502 0 0 39899 0 --:--:-- --:--:-- --:--:-- 39875 remote: Enumerating objects: 1, done. remote: Counting objects: 100% (1/1), done. remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0 (from 0) Unpacking objects: 100% (1/1), 354 bytes | 354.00 KiB/s, done. From https://github.com/GabrielKimm/uftrace * branch fix-tui-non-utf8-locale -> FETCH_HEAD Switched to and reset branch 'pull/1974' Now you're ready to review the pull request 1974 where can be found at namhyung#1974. Signed-off-by: Honggyu Kim <[email protected]>
Please use your name "Gabriel Kim" rather than "GabrielKim". |
6f8a9c8
to
72ef9b4
Compare
This commit addresses the issue namhyung#1870 where the TUI displays incorrect characters in non-UTF-8 locales. The fix includes: - Checking the current locale - Using ASCII characters for graph display in non-UTF-8 locales - Adjusting character widths accordingly Fixes: namhyung#1870 Signed-off-by: Gabriel Kim <[email protected]>
72ef9b4
to
bfa6fce
Compare
Thanks for the update. I will wait for @namhyung's review. |
Thank you so much for your invaluable feedback and guidance on this PR. I truly appreciate the time and effort you've put into reviewing my work and providing such constructive advice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've just tested this and it looks fine but I have some concerns by checking the value of LANG
.
The following can be another way to check if we can print graphical characters, but I'm not sure if it doesn't break other environments such as Android build, musl build, alpine Linux, etc.
#include <locale.h>
#include <wchar.h>
int can_print_utf8_graph_chars() {
const char *graph_char = "★";
wchar_t wc;
setlocale(LC_CTYPE, "");
int result = mbtowc(&wc, graph_char, MB_CUR_MAX);
if (result > 0 && wc != L'\0')
return true;
return false;
}
It usually takes some time to get patches for review but it'd be useful to have a script for that. The 'checkout-pr.sh' script accepts a single parameter to get the pull request ID. It fetches from the source repo and checkouts to the fetched head. The example usage is as follows. $ ./misc/checkout-pr.sh 1974 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18502 100 18502 0 0 39899 0 --:--:-- --:--:-- --:--:-- 39875 remote: Enumerating objects: 1, done. remote: Counting objects: 100% (1/1), done. remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0 (from 0) Unpacking objects: 100% (1/1), 354 bytes | 354.00 KiB/s, done. From https://github.com/GabrielKimm/uftrace * branch fix-tui-non-utf8-locale -> FETCH_HEAD Switched to and reset branch 'pull/1974' Now you're ready to review the pull request 1974 where can be found at #1974. Signed-off-by: Honggyu Kim <[email protected]>
Thank you for your thorough review and for pointing out these remaining display issues. I appreciate your attention to detail.
I plan to make the following improvements:
I'll update the PR with these changes soon 😊🙏🏻🙏🏻 |
This commit addresses the issue #1870 where the TUI displays incorrect characters in non-UTF-8 locales. The fix includes:
Fixes: #1870
Signed-off-by: Gabriel Kim [email protected]